<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>选择工作状态</title>
  <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
  <link rel="stylesheet" type="text/css" href="../css/common.css"/>
  <link rel="stylesheet" href="../css/page_css/util.css">
  <link rel="stylesheet" href="../css/page_css/work_order_sel_order.css">
</head>
<body>
  <div class="mui-content">
    <ul class="mui-table-view sel_status_ul" id="mui-table-view">
      <!-- 模板引擎 -->

    </ul>
  </div>
  <script type="text/javascript" src="../script/api.js"></script>
  <script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
  <script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
  <script src="../script/template.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/tempalte" id="tmpLiat">
    {{each datas as item i}}
      <li class="mui-table-view-cell mui-radio mui-left">
        <input name="sel_property_radio" type="radio" onchange="chStatus('{{item.id}}','{{item.name}}')">
        <div class="list_item">
          <div class="flex_center_between margin_b_8">
            <p class="flex_first">
              <span>{{item.name}}</span>
            </p>
          </div>
        </div>
      </li>
    {{/each}}
  </script>
  <script>
		var statusName,statusId;
    apiready = function(){
      onLoadData()
      Refresh(function() {
				onLoadData();
			});
      api.addEventListener({
        name:'navitembtn'
      },function(ret, err){
          if(ret.type == 'right'){
            if($api.dom("input[type='radio']:checked") == null){
              api.toast({
						    msg: '请选择一项!',
						    duration: 2000,
						    location: 'middle'
							});
              return false
            }
            api.sendEvent({
              name: 'status',
              extra: {
                statusId : statusId,
                statusName : statusName
              }
            });
            setTimeout(function(){
              api.closeWin();
            },100)
          }
      })
    }
		function onLoadData (page,load) {
			ajaxrd("queryOrderStatusList", {}, function(data, err) {
				api.refreshHeaderLoadDone();
        AddData('tmpLiat','mui-table-view',data);
				if (data.length < 10) {
					loadEnd = true
				}
			})
		}
    function chStatus(id, name) {
      statusId = id
      statusName = name
    }
  </script>
</body>
</html>
